package com.leetcode.p0;

import com.utils.DataUtils;

public class Test80 {

    public int removeDuplicates(int[] nums) {

        int k = 1;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] > nums[i - 1]) {
                nums[k] = nums[i];
                k++;
            }
        }

        return k;
    }

    public static void main(String[] args) {
        Test80 test = new Test80();
        int[] array = new int[]{1, 2, 2, 2, 3, 3, 3, 3, 4, 4};
//        int[] array = new int[]{1, 2, 2, 2};
        int count = test.removeDuplicates(array);
        DataUtils.printArray(array, count);
    }

}
